

	/*

		This Class is used for mapping object and key
	*/

import java.util.*;
public class SwapnilMap 
{

	public int count;
	int size=2;
	int i,j;
	public String[] Strarr;           //Array for key
	public Object[] objarr;                   //Array for object
	public SwapnilMap()
	{
		count=0;
		Strarr=new String[size];
		objarr=new Object[size]; 
	}
	
	
	

	/*
		This Function Map the Object and key 
	*/
	public void put(String arg1,Object arg2)                
	{
		
		if(count==size)
		{
			int tempcnt=count-1;
			String[] temp=new String[size];               // Extend size of array when array reach it's limit
			Object[] temp1=new Object[size];
			size=size+3;
			System.arraycopy(Strarr, 0, temp, 0, Strarr.length);
			System.arraycopy(objarr, 0,temp1 , 0, objarr.length);
			Strarr=new String[size];
			objarr=new Object[size];
			System.arraycopy(temp, 0, Strarr, 0, temp.length);
			System.arraycopy(temp1, 0, objarr, 0, temp1.length);
		}
		for(i=0;i<count;i++)
		{
			if(arg1.compareTo(Strarr[i])==0)
			{
				System.out.print("\n Key is present please enter the another emp id :");
				break;
			}
		}
		if(i==count)
		{	
			Strarr[count]=arg1;
			objarr[count]=arg2;
			count++;
		}
		
			
		
	}

	

	/*
		This function return Object of particular Key
	*/

	public Object get(String id)
	{
		for(i=0;i<count;i++)
		{
			
			if(id.compareTo(Strarr[i])==0)
			{
				return(objarr[i]);
			}
		}
		
			
		return null;
	}
	
	

	/*
		This function return the size of map
	*/

	public int size()
	{
		return(count);
	}

	

	/*
		This function check whether map is empty or not
	*/
	public boolean isEmpty()
	{
		if(count==0)
			return true;
		return false;
	}


	/*

		This function remove all elements form map and set to initial position
	*/

	public void clear()
	{
		int i;
		for(i=0;i<count;i++)
		{
			Strarr[i]="";
			objarr[i]=null;
		}
		count=0;
	}
	

	/*
		This function remove the given key-value from map
	*/
	public void remove(String arg0)
	{
		int j;
		for(i=0;i<count;i++)
		{
			
			if(arg0.compareTo(Strarr[i])==0)
			{
				break;	
			}
		}
		for(j=i;j<count;j++)
		{
			Strarr[i]=Strarr[i+1];
			objarr[i]=objarr[i+1];		
		}
		Strarr[j]="";
		objarr[j]=null;		
		
		count--;
	}

		
	/*
                This function return the all values from map
	*/

	public Object[] values()
	{
		return(objarr);
	}
	    	
	/*public List<Object> values()
	{
		 data=new ArrayList<Object>();
		//data.toArray(objarr);			
		for(i=0;i<count;i++)
		  data.add(objarr[i]);
		return data;
	}*/

	/*
		check whether key present or not 
	
	*/
	public boolean containskey(String id)
	{
		for(i=0;i<count;i++)
		{
			
			if(id.compareTo(Strarr[i])==0)
				return true;
		}
		return false;
	}

	/*
		this function return key in form of set
	*/
	
	public Set<String> KeySet()
	{
		 Set<String> key=new HashSet<String>();
		for(i=0;i<count;i++)
			key.add(Strarr[i]);
		return key;
	}


	/*
	          This function return key and value to set
	
	
	public Map.Entry<String,Salary> entrySet()
	{
		
		
	}
	
	*/

}
